﻿#ifndef PLUGINPHENGLEIEXTEND_H
#define PLUGINPHENGLEIEXTEND_H


#include "PHengLEIPluginAPI.h"
#include "PluginManager/pluginBase.h"
#include "DataProperty/modelTreeItemType.h"
#include "mainWindow/mainWindow.h"
#include "DataProperty/ParameterTable.h"
#include "DataProperty/ParameterSelectable.h"
#include "DataProperty/ParameterInt.h"
#include "DataProperty/ParameterBool.h"
#include "DataProperty/ParameterDouble.h"
#include "DataProperty/ParameterGroup.h"
#include <io.h>



namespace IO
{
    class SolverIO;
}

class IOConfig;

namespace ModelData
{
    class ModelDataBase;
}

namespace GUI
{
    class  MainWindow;
}

namespace Plugins
{
    static GUI::MainWindow* mMainWindow;
    class PHENGLEIPLUGINAPI PluginPHengLEIExtend :public PluginBase
    {
        Q_OBJECT
    public:
        PluginPHengLEIExtend(GUI::MainWindow* m);
        PluginPHengLEIExtend();
        //
        bool install() override;
        //
        bool uninstall() override;
    public:
        static int invalue;
        static GUI::MainWindow* getMainWindow();
    //private:
        //void sendMessageToConsole(QString hint);
    signals:
        void treePrintMessageToMessageWindowSignal(ModuleBase::Message message);
    private:
    };
}

extern"C"
{
    void PHENGLEIPLUGINAPI Register(GUI::MainWindow* m, QList<Plugins::PluginBase*>* plugph);
    void showmsg(QString inputtext);
    //
    bool PHENGLEIPLUGINAPI WriteOut(QString pathPH, ModelData::ModelDataBase* d);
    //
    bool PHENGLEIPLUGINAPI transfer(QString pathPH);
    //
    bool PHENGLEIPLUGINAPI  copyDirectoryFiles(const QString& fromDir, const QString& toDir, bool coverFileIfExist);
    //
    bool PHENGLEIPLUGINAPI  transfileToDest(const QString& fromDir, const QString& toDir, int type);
    //
    bool PHENGLEIPLUGINAPI writeScriptFile(QString filename, ModelData::ModelDataBase* d);
    //
    void PHENGLEIPLUGINAPI sendMessageToConsole(QString hintInfo);
    //
    bool PHENGLEIPLUGINAPI writeinputText(QString filename, ModelData::ModelDataBase* d);
    bool PHENGLEIPLUGINAPI writeMeshText(QString filename, ModelData::ModelDataBase* d);
    QString getParameterValue(QString paraname, ModelData::ModelDataBase* d);
    QString getParameterType(QString paraname, ModelData::ModelDataBase* d);
    DataProperty::ParameterTable* getParameterTable(QString paraname, ModelData::ModelDataBase* d);
    DataProperty::ParameterSelectable* getParameterSelectable(QString paraname, ModelData::ModelDataBase* d);
    QString getParameterGroupValue(QString paraname, QString rootname, ModelData::ModelDataBase* d);
    QString getParameterGroupType(QString paraname, QString rootname, ModelData::ModelDataBase* d);
    bool BCOperation(ModelData::ModelDataBase* d, QString& meshFilePath);
    bool insertBCInfo(QString& boundaryFilePath, QString bcName, QString bcType, QString bcCondition, double bcValue, ModelData::ModelDataBase* d);
    void GetFiles(std::string path, std::vector<std::string>&filenames);
}


#endif // !PLUGINPHENGLEIEXTEND_H



